package com.example.demo.common.result;

/**
 * @author xiaoge
 * @Description 枚举这个就类似静态类,目的是指定返回的规范
 * 规定:
 * #200表示成功
 * #1001～1999 区间表示参数错误
 * #2001～2999 区间表示用户错误
 * #3001～3999 区间表示接口异常
 * #4001～4999 区间表示业务错误
 * #5001～5999 区间表示部门错误
 * #9001～9999 区间表示运行时异常
 * #后面对什么的操作自己在这里注明就行了
 */
public enum ResultCode {

    /* 成功 */
    SUCCESS(200, "成功"),

    /* 默认失败 */
    COMMON_FAIL(999, "执行异常，请检查参数后重试"),

    /* 参数错误：1000～1999 */
    PARAM_NOT_VALID(1001, "参数无效"),
    PARAM_IS_BLANK(1002, "参数为空"),
    PARAM_IS_EXIST(1005, "用户名已存在"),
    PARAM_TYPE_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),

    /* 用户错误 */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
    USER_CREDENTIALS_ERROR(2003, "密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "您的登录已经超时或者已经在另一台机器登录，您被迫下线"),
    POSITION_ID_EMPTY(2010, "岗位ID为空"),

    /* 业务错误 */
    NO_PERMISSION(4001, "没有相关权限。"),

    /*部门错误*/
//    DEPARTMENT_NOT_EXIST(5007, "部门不存在"),
//    DEPARTMENT_ALREADY_EXIST(5008, "部门已存在"),

    /*钻孔错误*/
    ZK_NOT_FOUND(5001,"找不到这个钻孔"),
    UPDATE_NEED_ID(5002,"更新时需要输入id"),
    CHANGE_BORE_STATE_FAIL(5003,"改变钻孔状态失败"),
    DUPLICATED_DRILL_CODE(5004,"钻孔编号重复"),
    EPSG_IS_EMPTY(5005,"EPSG为空！请选择选坐标系"),
    DRILL_HOLE_NOT_FOUND(5006,"找不到钻孔信息"),
    DRILL_HOLE_ID_NOT_ONE(5007,"钻孔ID数量不为1"),


    /*Gmp处理异常*/
    BATCH_INSERT_FAIL(6001,"批量插入数据失败"),
    MEASURE_NOT_NULL(6002,"钻孔测量数据异常"),
    GROUP_INSERT_FAIL(6003,"添加分组失败"),

    /*钻机管理异常*/
    RIG_MIGRATION_FAIL(7001,"钻机迁移失败"),
    DUPLICATE_TEAM_NAME(7002,"所选项目与本项目有相同的班组名，迁移失败"),

    /*运行时异常*/
    ARITHMETIC_EXCEPTION(9001,"算数异常"),
    NULL_POINTER_EXCEPTION(9002,"空指针异常"),
    ARRAY_INDEX_OUTOfBOUNDS_EXCEPTION(9003,"数组越界"),
    DUPLICATE_KEY(9004,"数据中包含与数据库重复数据"),

    //QR二维码异常
    QRCODE_NOT_BELONG_PROJECT(10001,"这个样品不属于此项目！"),
    QRCODE_NOT_ENTER(10002,"这个样品尚未录入!"),

    INSERT_ERROR(12001,"插入失败"),
    UPDATE_ERROR(12002,"更新失败"),
    DELETE_ERROR(12003,"删除失败"),

    //自定义表相关错误
    CUSTOM_TABLE_TYPE_ERROR(13003,"自定义表类型出错"),
    CUSTOM_TABLE_FIELD_TYPE_ERROR(13004,"自定义表字段类型出错"),
    CUSTOM_TABLE_CREATE_FAILED_ERROR(13004,"自定义表创建失败"),
    CUSTOM_TABLE_ID_ERROR(13004,"挂载数据ID有误"),

    //文件相关异常
    FTP_CONNECT_FIELD(14001,"FTP连接失败！"),
    FILE_UPLOAD_FIELD(14002,"文件上传失败！"),
    FILE_GENERATE_FIELD(14003,"文件生成失败！"),
    FILE_DOWNLOAD_FIELD(14004,"文件下载失败！"),
    EXCEL_DATA_COUNT_WRONG_BIGGER_THAN_ONE(14005,"EXCEL数据有误,数据大于1条！"),


    //DXF解析异常
    DXF_FIND_BORE_OBJECT_FIELD(15001,"DXF寻找钻孔对象失败！"),
    DXF_BORE_OBJECT_EXCHANGE_FIELD(15002,"DXF转换钻孔对象失败！"),
    DXF_BORE_OBJECT_PROPERTY_FIELD(15002,"DXF钻孔对象属性异常！"),


    /*
    设备错误
     */
    DEVICE_NOT_FOUND(15001,"找不到设备信息"),
    DEVICE_ID_NOT_ONE(15002,"设备ID数量不为1"),

    //审核异常
    EXAMINE_NOT_EXIST(11001,"不存在的审核记录！"),
    EXAMINE_STATUS_WRONG(11002,"审核状态出错！");



    /**
     *
     */



    private Integer code;

    private String message;

    ResultCode(Integer code,String message){
        this.code = code;
        this.message = message;
    }


    public Integer getCode() {
        return code;
    }


    public String getMessage() {
        return message;
    }
}